<template>
  <div class="home">
    <!-- 筛选 -->
    <div class="search_content">
      <div class="task_header">
        <div class="top_title">
          <div class="top_title_back" @click="onClickLeft">
            <i class="iconfont icon-back"></i>
          </div>
          <div class="top_title_val">{{ $route.meta.title }}</div>
          <div class="onlyPerson">
            <div class="onlyPerson_txt">只看本人</div>

            <van-switch class="onlyPerson_switch" v-model="requestParams.isFollowPerson" size="13px" :inactive-value="0" :active-value="1" />
          </div>
        </div>

        <div class="task_header_data">
          <div class="task_header_date">
            <div class="task_header_date_w"></div>
            <div class="task_header_date_item" v-for="(item, index) in topDateList" :key="index" @click="handleFollowData(index)">{{ item }}</div>
          </div>
          <div class="task_header_followData">
            <div class="task_header_followData_tt">应跟</div>
            <div class="task_header_followData_item" v-for="(item, index) in shuldFollowList" :key="index" @click="handleFollowData(index)">
              {{ item }}
            </div>
          </div>
          <div class="task_header_followData">
            <div class="task_header_followData_tt">已跟</div>
            <div
              class="task_header_followData_item"
              v-for="(item, index) in hasShuldFollowList"
              :key="index"
              @click="handleFollowData(index)"
              :class="toptaskIndex == index ? 'active' : ''"
            >
              {{ item }}
            </div>
          </div>
          <div class="top_arrow top_left" @click.stop="handleEditTime('pre')">
            <van-icon name="arrow-left" size="18px" />
          </div>
          <div class="top_arrow top_right" @click.stop="handleEditTime('next')">
            <van-icon name="arrow" size="18px" />
          </div>
        </div>

        <div class="top_search">
          <div class="top_search_val">
            <form action>
              <van-search v-model="requestParams.codeNo" placeholder="请输入车架号或者车牌号" shape="round" @search="initData" @clear="clearSearch" />
            </form>
          </div>
          <div class="top_search_icon">
            <img @click="handleShowSearch" src="@/assets/images/search_bg.png" />
          </div>
        </div>
      </div>
    </div>
    <!-- 列表 -->
    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
      <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="loadData" v-if="recordList && recordList.length != 0">
        <div class="orderList">
          <div class="orderbox" v-for="(item, index) in recordList" :key="index">
            <div class="flex">
              <!-- <div class="taskCheck" v-if="showTransmitFlag">
                <van-checkbox v-model="item.check" shape="square" icon-size="15px"></van-checkbox>
              </div>-->
              <div class="orderItem" @click="goDetail(item)">
                <div v-if="item.isChild == 1" class="ischild">子任务</div>
                <div class="orderItem_box">
                  <div class="orderItem_header">
                    <div class="orderItem_lt">
                      <div class="carNo">
                        <div class="carNobox">
                          <div class="txt">{{ item.taskName }}</div>
                          <!-- <div class="txt1" v-if="item.vinCode">{{ item.vinCode }}</div> -->
                        </div>
                        <span :class="item.oneBillStatus == '已处理' ? 'carStatus' : 'noCarStatus'">{{ item.oneBillStatus }}</span>
                      </div>
                      <div class="vinNobox">
                        <div class="customerName">{{ item.customerName }}</div>
                        <div class="vinNo" v-if="item.vinCode" @click.stop="handleCopy(item.vinCode)">
                          {{ item.vinCode }}
                          <i class="iconfont icon-copy"></i>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="orderItem_content">
                  <div class="orderItem_data w65">
                    <div class="order_label">应跟进：</div>
                    <div class="txt">{{ item.shuldFollowTime ? item.shuldFollowTime : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w35">
                    <div class="order_label">{{ item.taskTypeName == '续保到期提醒' ? '是否续保' : '是否回场' }}：</div>
                    <div class="txt">{{ item.taskResult ? item.taskResult : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w65">
                    <div class="order_label">跟进人：</div>
                    <div class="txt">{{ item.taskPerson ? item.taskPerson : '暂无' }}</div>
                  </div>

                  <div class="orderItem_data w35">
                    <div class="order_label">客户管家：</div>
                    <div class="txt">{{ item.cusButName ? item.cusButName : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w65" v-if="item.taskTypeName == '续保到期提醒'">
                    <div class="order_label">续保提醒类型：</div>
                    <div class="txt">{{ item.insType ? item.insType : '暂无' }}</div>
                  </div>

                  <div class="orderItem_data w35" v-if="item.taskTypeName == '续保到期提醒'">
                    <div class="order_label">保险公司：</div>
                    <div class="txt">{{ item.insCmpName ? item.insCmpName : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w65">
                    <div class="order_label">当店上次进场：</div>
                    <div class="txt">{{ item.dateIn ? item.dateIn : '暂无' }}</div>
                  </div>

                  <div class="orderItem_data w35" v-if="item.taskTypeName == '续保到期提醒'">
                    <div class="order_label">终保日期：</div>
                    <div class="txt">{{ item.insureDate ? item.insureDate : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w35" v-else>
                    <div class="order_label">上次接待：</div>
                    <div class="txt">{{ item.serverName ? item.serverName : '暂无' }}</div>
                  </div>

                  <div class="orderItem_data w65" v-if="item.taskTypeName == '续保到期提醒'">
                    <div class="order_label">保险类型：</div>
                    <div class="txt">{{ item.insurance ? item.insurance : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w35" v-if="item.taskTypeName == '续保到期提醒'">
                    <div class="order_label">保险分类：</div>
                    <div class="txt">{{ item.insureType ? item.insureType : '暂无' }}</div>
                  </div>

                  <div class="orderItem_data w65">
                    <div class="order_label">最近跟进：</div>
                    <div class="txt">{{ item.lastFollowInTime ? item.lastFollowInTime : '暂无' }}</div>
                  </div>
                  <div class="orderItem_data w35">
                    <div class="order_label">跟进状态：</div>
                    <div class="txt">{{ item.twoBillStatus ? item.twoBillStatus : '暂无' }}</div>
                  </div>
                </div>

                <div class="orderItem_label">
                  <div class="label_item" v-for="(el, i) in item.label" :key="i">{{ el }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </van-list>
      <div class="no_icon" v-else>
        <img class="no_icon_img" src="@/assets/images/no_icon.png" />
        <div class="no_icon_txt">暂无内容</div>
      </div>
    </van-pull-refresh>
    <!--
    <div class="addBtn">
      <div class="footerBtn orderItem_filebox" @click="handleShowTransmit" v-if="!showTransmitFlag && recordList.length != 0">任务转交</div>
      <div class="flex" v-if="showTransmitFlag && recordList.length != 0">
        <div class="footerBtn comfirmBtn" @click.stop="handleTransmitSubmit">确认转交</div>
        <div class="footerBtn cancelBtn" @click.stop="handleTransmitCancel">取消</div>
      </div>
    </div>-->

    <van-dialog
      v-model="updateServiceVisible"
      title="转交跟进人"
      show-cancel-button
      @confirm="updateServiceConfirm"
      :before-close="beforeCloseUpdateTel"
    >
      <van-field
        v-model="updateServiceData.fixCenterName"
        name="所属维修中心"
        label="所属维修中心"
        input-align="right"
        placeholder="请选择"
        readonly
        right-icon="arrow"
        @click="handleUpdateSelect('updateServiceData', 'fixCenterId', 'fixCenterName')"
      />

      <van-field
        v-model="updateServiceData.followPersonName"
        name="跟进人"
        label="跟进人"
        input-align="right"
        placeholder="请选择"
        readonly
        right-icon="arrow"
        @click="handleUpdateSelect('updateServiceData', 'followPersonID', 'followPersonName')"
      />
    </van-dialog>

    <van-popup v-model="updateSelectVisible" position="bottom">
      <van-picker show-toolbar :columns="updateColumns" @confirm="handleUpdateSelectConfirm" @cancel="updateSelectVisible = false" value-key="name" />
    </van-popup>

    <div class="loading" v-if="loading">
      <van-loading size="30px" class="loadbox" color="#fff" text-color="#fff">加载中...</van-loading>
      <div class="mask"></div>
    </div>
    <!-- 搜索弹窗 -->
    <div class="search_info" v-if="searchVisible">
      <div class="pop_content">
        <div class="popSearch">
          <div class="popSearchbox">
            <div class="popSearchbox_item">
              <div class="popSearch_tt">应跟进时间</div>
              <div class="popSearch_time">
                <div class="popSearch_time_txt" @click="handleSelectTime('taskStartCreateTime')">
                  <input v-model="requestParams.taskStartCreateTime" class="popSearch_time_val" placeholder="开始时间" readonly />
                </div>
                <span class="popSearch_time_icon">-</span>
                <div class="popSearch_time_txt" @click="handleSelectTime('taskEndCreateTime')">
                  <input v-model="requestParams.taskEndCreateTime" class="popSearch_time_val" placeholder="结束时间" readonly />
                </div>
              </div>
            </div>
            <div class="popSearchbox_item">
              <div class="popSearch_tt">保险到期日</div>
              <div class="popSearch_time">
                <div class="popSearch_time_txt" @click="handleSelectTime('insureStartDate')">
                  <input v-model="requestParams.insureStartDate" class="popSearch_time_val" placeholder="开始时间" readonly />
                </div>
                <span class="popSearch_time_icon">-</span>
                <div class="popSearch_time_txt" @click="handleSelectTime('insureEndDate')">
                  <input v-model="requestParams.insureEndDate" class="popSearch_time_val" placeholder="结束时间" readonly />
                </div>
              </div>
            </div>

            <div class="popSearchbox_item">
              <div class="popSearch_tt">任务一级状态</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in oneBillStatusList"
                  :key="index"
                  @click="handleSearchSelect(index, 'oneBillStatusList', 'oneBillStatus')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>

            <div class="popSearchbox_item">
              <div class="popSearch_tt">任务二级状态</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in twoBillStatusList"
                  :key="index"
                  @click="handleSearchSelect(index, 'twoBillStatusList', 'twoBillStatus')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>

            <div class="popSearchbox_item">
              <div class="popSearch_tt">任务类型</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in taskTypeList"
                  :key="index"
                  @click="handleSearchSelect(index, 'taskTypeList', 'taskTypeId')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>

            <div class="popSearchbox_item">
              <div class="popSearch_tt">到店状态</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in taskResultList"
                  :key="index"
                  @click="handleSearchSelect(index, 'taskResultList', 'taskResult')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>
            <div class="popSearchbox_item">
              <div class="popSearch_tt">保险公司</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in insureList"
                  :key="index"
                  @click="handleSearchSelect(index, 'insureList', 'insCmpId')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>
            <div class="popSearchbox_item">
              <div class="popSearch_tt">续保提醒类型</div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in insTypeList"
                  :key="index"
                  @click="handleSearchSelect(index, 'insTypeList', 'insType')"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>

            <div class="popSearchbox_item">
              <div class="popSearch_tt">
                其他筛选(
                <span class="tips">选中代表是</span>)
              </div>
              <div class="popSearchbox_selectList">
                <div
                  class="popSearchbox_select_item"
                  :class="item.check ? 'active' : ''"
                  v-for="(item, index) in otherList"
                  :key="index"
                  @click="handleOtherSelect(index, 'otherList', item.field)"
                >
                  {{ item.name }}
                </div>
              </div>
            </div>
          </div>
          <div class="popSearchbox">
            <div class="popSearchbox_item">
              <div class="popSearch_tt">维修中心筛选</div>
              <van-field
                v-model="requestParams.fixCenterName"
                name="维修中心"
                label="维修中心"
                input-align="right"
                placeholder="请选择"
                readonly
                right-icon="arrow"
                @click="handleSelect('fixCenterId', 'fixCenterName')"
              />
              <van-field
                v-model="requestParams.taskPersonName"
                name="跟进人"
                label="跟进人"
                input-align="right"
                placeholder="请选择"
                readonly
                right-icon="arrow"
                @click="handleSelect('taskPersonId', 'taskPersonName')"
              />
              <van-field
                v-model="requestParams.serverPsnName"
                name="服务顾问"
                label="服务顾问"
                input-align="right"
                placeholder="请选择"
                readonly
                right-icon="arrow"
                @click="handleSelect('serverPsnId', 'serverPsnName')"
              />
            </div>
          </div>
          <div class="popSearch_footer">
            <div class="popSearch_btn reset_btn" @click.stop="handleSearchReset">重置</div>
            <div class="popSearch_btn save_btn" @click.stop="handleSearchSave">保存方案</div>
            <div class="popSearch_btn confirm_btn" @click.stop="handleSearchConfirm">确认</div>
          </div>
        </div>
      </div>
      <div class="mask" @click="searchVisible = false"></div>
    </div>
    <van-popup v-model="showSelectPicker" position="bottom">
      <van-field
        name="模糊查询"
        input-align="left"
        v-model="likeWho"
        label="模糊查询"
        v-if="likeWhoField == 'fixCenterId' || likeWhoField == 'taskPersonId' || likeWhoField == 'serverPsnId'"
        placeholder="请输入模糊查询关键词"
      />
      <van-picker show-toolbar :columns="columns" @confirm="handleSelectConfirm" @cancel="showSelectPicker = false" value-key="name" />
    </van-popup>
    <van-popup v-model="showPickerDate" position="bottom">
      <van-datetime-picker v-model="currentDate" type="date" @cancel="onCancelDate" @confirm="onConfirmDate" :formatter="formatter" />
    </van-popup>
  </div>
</template>

<script>
import { Dialog, DropdownItem, DropdownMenu, Empty, Loading, Notify, Search, Toast } from 'vant'
import taskApi from '@/api/taskApi'
import commonApi from '@/api/commonApi'
import {
  copyToClipboard,
  getCookies,
  getCurrentFirstDay,
  getCurrentMonthLastDay,
  getCurrentTime,
  getYesterdayTime
} from '@/utils/util.js'

export default {
  name: 'repairOrder',
  components: {
    Search,
    DropdownMenu,
    DropdownItem,
    Empty,
    Dialog,
    Notify,
    Loading,
    Toast,
  },
  data() {
    return {
      taskTypeList: [],
      statusList: [
        { name: '已处理', code: 1, check: false },
        { name: '未处理', code: 2, check: false },
      ],
      recordList: [
        // {
        //   billId: "1", //单据ID
        //   carNo: "闽D66666", //车牌号
        //   taskName: "闽D66666定期保养招揽", //任务名称
        //   taskPerson: "张三", //跟进人
        //   oneBillStatus: "未处理", //任务一级状态
        //   twoBillStatus: "未处理", //任务二级状态
        //   customerName: "李四", //客户名称
        //   mobile1: "", //手机1
        //   mobile12: "", //手机2
        //   serverName: "王武", //所属服务顾问
        //   carModel: "CT5 2,0T", //车型
        //   carMiles: "8888", //公里数
        //   dateIn: "2023-06-25", //最近进场日期
        // },
      ],
      columns: [],
      showSelectPicker: false,
      requestParams: {
        codeNo: '', //车架号或者车牌号，String，必填
        pageNo: 1, //当前页数，默认从1开始，每页显示十条，int，不能为空或者小于1
        oneBillStatus: 'unDeal', //任务一级状态
        twoBillStatus: '', //任务二级状态
        taskTypeId: '', //任务类型ID值
        taskPersonId: '', //任务跟进人，ID值
        taskPersonName: '', //任务跟进人，ID值
        fixCenterId: '',
        fixCenterName: '',
        serverPsnId: '',
        serverPsnName: '',
        taskStartCreateTime: getCurrentTime(),
        taskEndCreateTime: getCurrentTime(),
        isExceed: '', //是否逾期，1为是，0为否
        isGenRepBook: '', //是否生成维修预约单
        billId: '', //本身单据ID，此为详细界面使用
        carId: '', //车辆ID，此为详细界面使用
        userId: getCookies('userId'), //用户ID，必填，String
        isFactTask: '', //是否厂家任务
        isHuiYuan: '', //是否会员客户
        isHYCar: '', //是否会员绑定车辆
        isFollowPerson: 1, //是否默认跟进人，1为是，0为否
        taskResult: '',
        taskResultName: '',
        isChild: '', //是否子任务
        isMonthChild: '', //是否跨月子任务
        insureStartDate: '', //开始终保日期，yyyy-MM-dd值
        insureEndDate: '', //结束终保日期，yyyy-MM-dd值
        insCmpId: '', //保险公司ID，取值基础码表
        insType: '', //续保到期提醒，枚举值
      },
      serviceList: [],
      showTransmitFlag: false,
      timeField: '',
      showPickerDate: false,
      currentDate: new Date(),
      list: [],
      // 分页参数
      loading: false,
      finished: false,
      refreshing: false,
      isLoadData: false,

      field: '',
      fieldName: '',
      fixCenterList: [],
      oneBillStatusList: [],
      twoBillStatusList: [],
      // 变更顾问字段
      updateServiceVisible: false,
      updateSelectVisible: false,

      updateServiceData: {
        fixCenterId: '',
        fixCenterName: '',
        followPersonID: '',
        followPersonName: '',
        billIds: '',
      },
      updateDataField: '',
      updateDataChirldenField: '',
      updateDataChirldenFieldName: '',
      updateColumns: [],
      likeWho: '',
      likeWhoField: '',
      followPersonList: [],
      taskResultList: [],
      followData: [
        {
          name: '今天',
          value: 100,
          value2: 200,
        },
      ],
      topDateList: ['今天', '昨天'],
      shuldFollowList: [],
      hasShuldFollowList: [],
      searchVisible: false,

      otherList: [
        // {
        //   name: '是否默认跟进人',
        //   value: 1,
        //   check: true,
        //   field: 'isFollowPerson',
        // },
        {
          name: '是否逾期任务',
          value: 0,
          check: false,
          field: 'isExceed',
        },
        {
          name: '是否生成预约单',
          value: 0,
          check: false,
          field: 'isGenRepBook',
        },
        {
          name: '是否厂家任务',
          value: 0,
          check: false,
          field: 'isFactTask',
        },
        {
          name: '是否会员客户',
          value: 0,
          check: false,
          field: 'isHuiYuan',
        },
        {
          name: '是否会员绑定车辆',
          value: 0,
          check: false,
          field: 'isHYCar',
        },
        {
          name: '是否子任务',
          value: 0,
          check: false,
          field: 'isChild',
        },
        {
          name: '是否跨月子任务',
          value: 0,
          check: false,
          field: 'isMonthChild',
        },
      ],
      paramDateList: [],
      toptaskIndex: 1,
      weekParams: {
        startDate: '', //必填，String，yyyyMMdd，
        endDate: '', //必填，String，yyyyMMdd，
        isFollowPerson: 1, //是否本人，1为是
      },
      insureList: [],
      insTypeList: [],
    }
  },
  watch: {
    likeWho: function (nval, oval) {
      if (this.likeWhoField == 'fixCenterId') {
        if (nval) {
          let newArr = this.fixCenterList.filter((item) => {
            return item.name.indexOf(nval) > -1
          })
          console.log(newArr)
          this.columns = newArr
        } else {
          this.columns = this.fixCenterList
        }
      }
      if (this.likeWhoField == 'taskPersonId') {
        if (nval) {
          let newArr = this.followPersonList.filter((item) => {
            return item.name.indexOf(nval) > -1
          })
          console.log(newArr)
          this.columns = newArr
        } else {
          this.columns = this.followPersonList
        }
      }
      if (this.likeWhoField == 'serverPsnId') {
        if (nval) {
          let newArr = this.serviceList.filter((item) => {
            return item.name.indexOf(nval) > -1
          })
          console.log(newArr)
          this.columns = newArr
        } else {
          this.columns = this.serviceList
        }
      }
    },
    searchVisible: function (val, oVal) {
      if (val) {
        document.body.style.overflow = 'hidden'
        if (this.taskTypeList.length == 0) {
          this.getTaskType()
        }
        if (this.oneBillStatusList.length == 0) {
          this.getOneBillStatusList()
        }
        if (this.twoBillStatusList.length == 0) {
          this.getTwoBillStatusList()
        }
        if (this.taskResultList.length == 0) {
          this.getTaskResult()
        }
        if (this.fixCenterList.length == 0) {
          this.getMainFixCenter()
        }
        if (this.insureList.length == 0) {
          this.getInsComList()
        }
        if (this.insTypeList.length == 0) {
          this.getInsTypeList()
        }
      } else {
        document.body.style.overflow = ''
      }
    },
    'requestParams.isFollowPerson': function (val, oVal) {
      if (val || val == 0) {
        this.getCustomerTaskWeekCount()
        this.initData()
      }
    },
  },
  created() {
    console.log('-------------------------------------')
    if (localStorage.getItem('skipUrl')) {
      localStorage.setItem('isRunFlag', true)
    }
    if (localStorage.getItem('taskSearchParam')) {
      this.requestParams = JSON.parse(localStorage.getItem('taskSearchParam'))
      if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
        this.showStorgeOtherParam()
      }
    }
  },
  mounted() {
    document.title = '保客通'
    if (localStorage.getItem('taskParams')) {
      let taskParams = JSON.parse(localStorage.getItem('taskParams'))
      this.requestParams.oneBillStatus = taskParams.billStatus
      this.requestParams.taskStartCreateTime = taskParams.dateTime
      this.requestParams.taskEndCreateTime = taskParams.dateTime
    }

    this.initData()
    this.getDateList(getYesterdayTime())
  },
  activated() {
    localStorage.setItem('skipUrl', '')
    localStorage.setItem('taskParams', '')
    let taskFollowId = localStorage.getItem('taskFollowId')
    if (taskFollowId) {
      let arr = taskFollowId.split(';')
      this.recordList &&
        this.recordList.forEach((item, index) => {
          arr &&
            arr.forEach((el, ei) => {
              if (item.billId == el) {
                this.recordList.splice(index, 1)
              }
            })
        })
    }
    // this.initData()
  },

  methods: {
    // 获取顶部时间
    getDateList(time) {
      let dateList = []
      var currentDate = new Date(time)
      for (let i = 0; i < 5; i++) {
        // 将当前日期向前移动一天
        var previousDay = new Date(currentDate.getTime() + i * 24 * 60 * 60 * 1000)
        dateList.push(previousDay.toLocaleString('zh-CN', { day: 'numeric' }))
        // 输出结果
      }
      let arr = dateList.map((item) => item.replace('日', ''))
      this.paramDateList = this.getNextSevenDays(time)
      if (time == getYesterdayTime()) {
        arr[0] = '昨天'
        arr[1] = '今天'
        arr[2] = '明天'
      }
      this.topDateList = arr
      console.log(this.paramDateList)
      console.log(this.topDateList)
      this.getCustomerTaskWeekCount()
    },
    // 获取当前时间格式yyyy-mm-dd
    getNextSevenDays(time) {
      let dates = []
      for (let i = 0; i < 5; i++) {
        let date = new Date(time) // 当前日期
        date.setDate(date.getDate() + i) // 增加天数
        let year = date.getFullYear()
        let month = (date.getMonth() + 1).toString().padStart(2, '0') // 月份是从0开始的
        let day = date.getDate().toString().padStart(2, '0')
        let formattedDate = `${year}-${month}-${day}`
        dates.push(formattedDate)
      }
      return dates
    },
    // 获取顶部数据
    getCustomerTaskWeekCount() {
      let data = JSON.parse(JSON.stringify(this.weekParams))
      data.startDate = this.paramDateList[0].replace(/-/g, '')
      data.endDate = this.paramDateList[4].replace(/-/g, '')
      data.isFollowPerson = this.requestParams.isFollowPerson
      taskApi.getCustomerTaskWeekCount({ ...data }).then((res) => {
        if (res.code == 1) {
          if (res.totalUndeal && res.totalUndeal.length != 0) {
            this.shuldFollowList = res.totalDeal
          } else {
            this.shuldFollowList = [0, 0, 0, 0, 0]
          }
          if (res.totalDeal && res.totalDeal.length != 0) {
            this.hasShuldFollowList = res.totalUndeal
          } else {
            this.hasShuldFollowList = [0, 0, 0, 0, 0]
          }
        }
      })
    },
    // 获取最后一天时间
    getCutTime(time) {
      // 创建表示2024-03-15的Date对象
      var originalDate = new Date(time)
      // 减去一天
      var oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数
      var previousDay = new Date(originalDate - oneDay)
      return previousDay.toISOString().substring(0, 10)
      // 输出结果
    },
    // 上一页时间，获取第一天时间，通过最后一天往前加7天
    getAddTime(time) {
      var date = new Date(time)
      date.setDate(date.getDate() + 5)
      return date.toISOString().substring(0, 10)
    },
    getCutTime(time) {
      var date = new Date(time)
      date.setDate(date.getDate() - 5)
      return date.toISOString().substring(0, 10)
    },

    handleEditTime(type) {
      if (type == 'pre') {
        this.getDateList(this.getCutTime(this.paramDateList[0]))
        this.toptaskIndex = 0
        this.requestParams.taskStartCreateTime = this.paramDateList[0]
        this.requestParams.taskEndCreateTime = this.paramDateList[0]
        this.initData()
      }
      if (type == 'next') {
        this.getDateList(this.getAddTime(this.paramDateList[0]))
        this.toptaskIndex = 0
        this.requestParams.taskStartCreateTime = this.paramDateList[0]
        this.requestParams.taskEndCreateTime = this.paramDateList[0]
        this.initData()
      }
    },
    // 切换时间
    handleFollowData(index) {
      let date = new Date()
      let year = date.getFullYear() // 年
      let month = date.getMonth() + 1 // 月
      month = month < 10 ? '0' + month : month
      if (this.toptaskIndex == index) {
        if (localStorage.getItem('taskSearchParam')) {
          let taskSearchParam = JSON.parse(localStorage.getItem('taskSearchParam'))
          this.requestParams.taskStartCreateTime = taskSearchParam.taskStartCreateTime
          this.requestParams.taskEndCreateTime = taskSearchParam.taskEndCreateTime
        } else {
          this.requestParams.taskStartCreateTime = getCurrentFirstDay()
          this.requestParams.taskEndCreateTime = getCurrentMonthLastDay()
        }
        this.toptaskIndex = null
      } else {
        this.requestParams.taskStartCreateTime = this.paramDateList[index]
        this.requestParams.taskEndCreateTime = this.paramDateList[index]
        this.toptaskIndex = index
      }

      this.initData()
    },
    // 初始化列表
    initData() {
      this.requestParams.pageNo = 1
      this.loadData()
    },
    // 获取列表
    loadData() {
      if (this.isLoadData) return
      this.isLoadData = true
      this.loading = true
      this.finished = false
      taskApi
        .getCustomerTaskList({ ...this.requestParams })
        .then((res) => {
          if (res.data && res.data.length) {
            res.data.forEach((item) => {
              item.check = false

              item.label = item.label ? item.label.split(';') : []
              if (item && item.label && item.label.length != 0) {
                item.label.length = item.label.length - 1
              }
            })
          }
          if (this.requestParams.pageNo == 1) {
            this.recordList = res.data || []
          } else {
            this.recordList = this.recordList.concat(res.data || [])
          }
          this.requestParams.pageNo += 1

          if (res.data.length < 10) {
            this.finished = true
            this.isLoadData = true
          }
          this.isLoadData = false
          this.loading = false
        })
        .catch((res) => {
          this.loading = false
          this.isLoadData = false
        })
    },
    // 下拉刷新
    onRefresh() {
      // 清空列表数据
      this.recordList = []
      this.finished = false
      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      this.loading = true
      this.refreshing = false
      this.initData()
    },
    // 获取任务类型
    getTaskType() {
      commonApi.getTaskType({ userId: this.requestParams.userId }).then((res) => {
        this.taskTypeList = this.formatCheckData(res.data)

        if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
          this.showStorgeParam('taskTypeList', 'taskTypeId')
        }
      })
    },
    // 保险公司
    getInsComList() {
      commonApi
        .getBaseCode({
          key: '保险公司',
          userId: this.requestParams.userId,
        })
        .then((res) => {
          if (res.data) {
            const filteredArray = res.data.filter((item, index, self) => {
              // 使用findIndex查找当前项在数组中第一次出现的索引
              const firstIndex = self.findIndex((obj) => obj.name === item.name && obj.billId === item.billId)

              // 如果当前项就是第一次出现的项，则返回true，保留在结果数组中
              return index === firstIndex
            })
            this.insureList = this.formatCheckData(filteredArray)
            // this.insureList = this.formatCheckData(res.data)
            if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
              this.showStorgeParam('insureList', 'insCmpId')
            }
          }
        })
    },
    // 获取维修中心
    getMainFixCenter() {
      commonApi
        .getMainFixCenter({
          userId: this.requestParams.userId,
          type: 'fixCenter',
        })
        .then((res) => {
          this.fixCenterList = res.data
        })
    },
    // 获取服务顾问
    getEmpPerson() {
      commonApi
        .getEmpPerson({
          fixCenterId: this.updateSelectVisible ? this.updateServiceData.fixCenterId : this.requestParams.fixCenterId,
          userId: this.requestParams.userId,
          type: 'taskFollow',
        })
        .then((res) => {
          this.serviceList = res.data
        })
    },
    // 获取跟进人员
    getFollowPerson() {
      commonApi
        .getEmpPerson({
          fixCenterId: this.updateSelectVisible ? this.updateServiceData.fixCenterId : this.requestParams.fixCenterId,
          userId: this.requestParams.userId,
          type: 'followPerson',
        })
        .then((res) => {
          this.followPersonList = res.data
        })
    },

    // 获取保险一级状态
    getOneBillStatusList() {
      commonApi.getEnums({ key: 'oneBillStatus', userId: this.requestParams.userId }).then((res) => {
        if (res.data) {
          this.oneBillStatusList = this.formatCheckData(res.data)
          if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
            this.showStorgeParam('oneBillStatusList', 'oneBillStatus')
          } else {
            this.oneBillStatusList = this.oneBillStatusList.filter((item) => item.value != 'isNull')
            this.oneBillStatusList[2].check = true
          }
        }
      })
    },
    // 获取续保提醒类型
    getInsTypeList() {
      commonApi.getEnums({ key: 'customerTaskInsureType', userId: this.requestParams.userId }).then((res) => {
        if (res.data) {
          this.insTypeList = this.formatCheckData(res.data)
          if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
            this.showStorgeParam('insTypeList', 'insType')
          }
        }
      })
    },

    // 回显缓存的参数
    showStorgeParam(listField, field) {
      let taskSearchParam = JSON.parse(localStorage.getItem('taskSearchParam'))
      let arr = taskSearchParam[field].split(';')

      this[listField] &&
        this[listField].forEach((item, index) => {
          arr &&
            arr.forEach((el, ei) => {
              if (field == 'taskTypeId') {
                if (item.billId == el) {
                  item.check = true
                }
              } else {
                if (item.value == el) {
                  item.check = true
                }
              }
            })
        })
    },
    // 回显其他筛选
    showStorgeOtherParam() {
      let taskSearchParam = JSON.parse(localStorage.getItem('taskSearchParam'))
      this.otherList.forEach((item, index) => {
        if (taskSearchParam[item.field]) {
          item.check = true
        }
      })
    },
    // 获取保险一级状态
    getTwoBillStatusList() {
      commonApi.getEnums({ key: 'twoBillStatus', userId: this.requestParams.userId }).then((res) => {
        if (res.data) {
          this.twoBillStatusList = this.formatCheckData(res.data)
          if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
            this.showStorgeParam('twoBillStatusList', 'twoBillStatus')
          }
        }
      })
    },
    // 获取是否到店枚举
    getTaskResult() {
      commonApi.getEnums({ key: 'taskResult', userId: this.requestParams.userId }).then((res) => {
        if (res.data) {
          this.taskResultList = this.formatCheckData(res.data)
          if (localStorage.getItem('taskSearchParam') && localStorage.getItem('taskSearchParam') != '{}') {
            this.showStorgeParam('taskResultList', 'taskResult')
          }
        }
      })
    },

    // 格式化多选数据
    formatCheckData(data) {
      data &&
        data.forEach((item) => {
          item.check = false
        })
      return data
    },

    // 选择下拉
    handleSelect(field, fieldName) {
      if ((field == 'serverPsnId' || field == 'taskPersonId') && !this.requestParams.fixCenterId) {
        Toast('请先选择维修中心')
        return
      }
      this.showSelectPicker = true
      if (field == 'carCoupon') {
        this.columns = [
          { name: '是', value: 1 },
          { name: '否', value: 2 },
        ]
      } else if (field == 'serverPsnId') {
        this.columns = this.serviceList
      } else if (field == 'fixCenterId') {
        this.columns = this.fixCenterList
      } else if (field == 'taskPersonId') {
        this.columns = this.followPersonList
      } else if (field == 'taskResult') {
        this.columns = this.taskResultList
      }
      this.likeWhoField = field

      this.field = field
      this.fieldName = fieldName
    },

    // 选择下拉确认
    handleSelectConfirm(value, index) {
      if (this.field == 'taskResult') {
        this.requestParams[this.field] = value.value
        this.requestParams[this.fieldName] = value.name
      } else {
        this.requestParams[this.field] = value.billId
        this.requestParams[this.fieldName] = value.name
      }

      if (this.field == 'fixCenterId') {
        this.getEmpPerson()
        this.getFollowPerson()
        this.requestParams.serverPsnId = ''
        this.requestParams.serverPsnName = ''
      }
      this.likeWho = ''
      this.likeWhoField = ''
      this.showSelectPicker = false
    },

    // 所属服务顾问重置
    handleReset() {
      this.requestParams.fixCenterId = ''
      this.requestParams.outUser = ''
    },

    // 时间确认
    onConfirmDate() {
      this.requestParams[this.timeField] = `${this.value1}-${this.value2}-${this.value3}` // 字符串拼接 结果入2020-07-03
      this.onCancelDate()
    },
    onCancelDate() {
      this.showPickerDate = false
    },

    // 日期组件自定义格式
    formatter(type, value) {
      if (type === 'year') {
        this.value1 = value // 可以拿到当前点击的数值
        return `${value}年`
      } else if (type === 'month') {
        this.value2 = value
        return `${value}月`
      }
      this.value3 = value
      return `${value}日`
    },

    // 获取list名称
    getFieldName(list, key, val) {
      if (list && list.length > 0) {
        let obj = list.filter((item) => {
          return item[key] == val
        })
        if (obj.length > 0) {
          return obj[0].name
        }
      }
      return null
    },

    // 详情
    goDetail(data) {
      localStorage.setItem('taskBillId', data.billId)
      this.$router.push({
        path: '/taskCenterDetail',
      })
    },
    // 顶部筛选选择数据
    handleSearchSelect(index, listKey, field) {
      this[listKey][index].check = !this[listKey][index].check
      console.log(this[listKey])
      let data = []
      if (field == 'taskTypeId' || field == 'insCmpId') {
        this[listKey].forEach((el, ei) => {
          if (el.check) {
            data.push(el.billId)
          }
        })
      } else {
        this[listKey].forEach((el, ei) => {
          if (el.check) {
            data.push(el.value)
          }
        })
      }

      this.requestParams[field] = data && data.length != 0 ? data.join(';') : ''
      console.log(this.requestParams)
    },
    // 其他筛选
    handleOtherSelect(index, listKey, field) {
      this[listKey][index].check = !this[listKey][index].check
      this.requestParams[field] = this[listKey][index].check ? 1 : 0
    },

    // 是否数据选择
    handleIsSelect(index, key, list, field) {
      this[key] = index
      this.requestParams[field] = this[list][index].billId
    },
    // 任务转交展示
    handleShowTransmit() {
      this.showTransmitFlag = true
    },
    // 确认转交
    handleTransmitSubmit() {
      let ids = []
      for (let i = 0; i < this.recordList.length; i++) {
        let item = this.recordList[i]
        if (item.check) {
          ids.push(item.billId)
        }
      }
      if (ids.length == 0) {
        Notify({ type: 'danger', message: '请至少选择一个任务' })
        return
      }
      this.updateServiceData.billIds = ids.join(';')
      this.updateServiceVisible = true
    },
    // 取消
    handleTransmitCancel() {
      this.showTransmitFlag = false
    },
    // 时间筛选
    handleSelectTime(field) {
      this.timeField = field
      this.showPickerDate = true
    },
    // 弹窗下拉
    handleUpdateSelect(data, field, fieldName) {
      this.updateSelectVisible = true
      this.updateDataField = data
      this.updateDataChirldenField = field
      this.updateDataChirldenFieldName = fieldName
      if (field == 'fixCenterId') {
        this.updateColumns = this.fixCenterList
        // console.log(this.followPersonList)
      }
      if (field == 'followPersonID') {
        this.updateColumns = this.followPersonList
      }
    },
    // 更新下拉确认
    handleUpdateSelectConfirm(value) {
      this[this.updateDataField][this.updateDataChirldenFieldName] = value.name
      this[this.updateDataField][this.updateDataChirldenField] = value.billId
      if (this.updateDataField == 'updateServiceData') {
        this.getFollowPerson()
      }
      this.updateSelectVisible = false
    },

    // 任务转交
    showUpdateService(data) {
      this.updateServiceVisible = true
    },

    // 任务转交
    updateServiceConfirm() {
      if (!this.updateServiceData.fixCenterId) {
        Notify({ type: 'danger', message: '请选择维修中心' })
        return
      }
      if (!this.updateServiceData.followPersonID) {
        Notify({ type: 'danger', message: '请选择跟进人' })
        return
      }
      taskApi
        .customerTaskFollow({
          ...this.updateServiceData,
        })
        .then((res) => {
          if (res.code == 1) {
            Notify({ type: 'success', message: '更新成功' })
            this.showTransmitFlag = false
            this.onRefresh()
          } else {
            Notify({ type: 'danger', message: res.errorMessage })
          }
        })

      this.updateServiceVisible = false

      this.clearDialogData()
    },
    // 清除弹窗信息
    clearDialogData() {
      this.updateServiceData = {
        fixCenterId: '',
        fixCenterName: '',
        followPersonID: '',
        followPersonName: '',
        billIds: '',
      }
    },
    beforeCloseUpdateTel(action, done) {
      if (action === 'confirm') {
        return done(false)
      } else {
        return done()
      }
    },
    clearSearch() {
      this.requestParams.codeNo = ''
      this.initData()
    },
    onClickLeft() {
      localStorage.setItem('skipUrl', '')
      localStorage.setItem('taskParams', '')
      // this.handleSearchReset()
      this.$router.push('/home')
    },

    // 展示筛选
    handleShowSearch() {
      this.searchVisible = true
    },
    // 重置任务状态
    handleSearchReset() {
      this.taskTypeList &&
        this.taskTypeList.forEach((item) => {
          item.check = false
        })
      this.oneBillStatusList &&
        this.oneBillStatusList.forEach((item) => {
          item.check = false
        })
      this.twoBillStatusList &&
        this.twoBillStatusList.forEach((item) => {
          item.check = false
        })
      this.otherList &&
        this.otherList.forEach((item) => {
          item.check = false
        })
      this.taskResultList &&
        this.taskResultList.forEach((item) => {
          item.check = false
        })
      this.insureList &&
        this.insureList.forEach((item) => {
          item.check = false
        })
      this.insTypeList &&
        this.insTypeList.forEach((item) => {
          item.check = false
        })
      this.requestParams.oneBillStatus = ''
      this.requestParams.twoBillStatus = ''
      this.requestParams.taskStartCreateTime = ''
      this.requestParams.taskEndCreateTime = ''
      this.requestParams.taskTypeId = ''
      this.requestParams.fixCenterId = ''
      this.requestParams.outUser = ''
      this.requestParams.fixCenterId = ''
      this.requestParams.fixCenterName = ''
      this.requestParams.serverPsnId = ''
      this.requestParams.serverPsnName = ''
      this.requestParams.taskPersonId = ''
      this.requestParams.taskPersonName = ''
      this.requestParams.isHuiYuan = ''
      this.requestParams.isFactTask = ''
      // this.requestParams.isFollowPerson = ''
      this.requestParams.taskResult = ''
      this.requestParams.taskResultName = ''
      this.requestParams.insureStartDate = ''
      this.requestParams.insureEndDate = ''
      this.requestParams.insCmpId = ''
      this.requestParams.insType = ''

      this.serviceList = []
      localStorage.setItem('taskSearchParam', '')
    },
    handleSearchSave() {
      this.requestParams.pageNo = 1
      localStorage.setItem('taskSearchParam', JSON.stringify(this.requestParams))
      Toast('保存成功')
    },
    handleSearchConfirm() {
      this.initData()
      this.searchVisible = false
    },
    handleCopy(data) {
      copyToClipboard(data)
      Toast('复制成功')
      // Notify({ type: 'success', message: '复制成功' })
    },
    handleSearchSave() {
      localStorage.setItem('taskSearchParam', JSON.stringify(this.requestParams))
      Toast('保存成功')
    },
    handleSearchConfirm() {
      this.initData()
      this.searchVisible = false
    },
  },
}
</script>
<style>
html,
body {
  font-size: 50px !important;
  background: #fff;
  box-sizing: border-box;
}
</style>
<style lang="less" scoped>
//@font-face {
//  font-family: 'Alibaba';
//  src: url('~@/assets/fonts/alibaba2.ttf');
//}

body {
  //font-family: 'Alibaba';
}

.home {
  background: #f2f2f2;
  //font-family: 'Alibaba';
}

.search_content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
}

.timebox {
  /deep/.van-cell::after {
    border: none;
  }

  .time_item {
    /deep/.van-field__control--right {
      border: 1px solid #d1d1d1;
      padding: 0.1rem 0;
      text-align: center;
      border-radius: 3px;
    }
  }
}

.searchbox {
  padding: 0.3rem;

  .time_icon {
    font-size: 24px;
    color: #999;
  }

  .title {
    font-size: 0.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.2rem;
    padding-top: 0.2rem;
  }

  .insureList {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;

    .insure_item {
      text-align: center;
      padding: 0.15rem 0rem;
      width: 30%;
      box-sizing: border-box;
      font-size: 0.28rem;
      border-radius: 3px;
      color: #666;
      margin-bottom: 0.2rem;
      margin-right: 5%;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.5);

      &:nth-child(3n) {
        margin-right: 0;
      }

      &.active {
        box-shadow: 0px 0px 3px 0px #f65e07;
        color: #f65e07;
      }
    }
  }

  .insureBtn {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.4rem;

    .resetBtn {
      padding: 0 0.4rem;
      margin-right: 0.2rem;
    }

    .confirmBtn {
      padding: 0 0.4rem;
      margin-right: 0.2rem;
    }

    .saveBtn {
      padding: 0 0.4rem;
      margin-right: 0.2rem;
    }
  }
}

.orderList {
  margin: 0.2rem 0.2rem 0 0.2rem;
  // overflow: hidden;

  .orderbox {
    width: 100%;
  }

  // padding-bottom: 1.5rem;
  .taskCheck {
    margin-right: 0.1rem;
  }

  .orderItem {
    padding: 11px 10px;
    background: #fff;
    border-radius: 5px;
    width: 100%;
    margin-bottom: 12px;
    position: relative;

    // &:last-child {
    //   margin-bottom: 0;
    // }
    .ischild {
      position: absolute;
      left: 0;
      top: -4px;
      font-size: 10px;
      background: rgba(215, 143, 0, 0.4);

      color: #eb6f03;
      padding: 2px 4px;
      border-radius: 2px;
    }

    .orderItem_box {
      margin-bottom: 10px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(216, 216, 216, 0.3);
      position: relative;

      .vinNobox {
        display: flex;
        align-items: center;
        margin-top: 4px;
        width: 100%;

        .customerName {
          margin-right: 13px;
          font-size: 0.24rem;
          color: #000;
        }
      }

      .vinNo {
        font-size: 0.24rem;
        color: #333;
        font-weight: bold;
        display: flex;
        align-items: center;
        .icon-copy {
          font-size: 14px;
        }
      }
    }

    .orderItem_header {
      // display: flex;
      justify-content: space-between;
      align-items: center;

      .orderItem_lt {
        .carNo {
          display: flex;
          justify-content: space-between;
          font-size: 0.26rem;
          color: #333;
          font-weight: bold !important;
          align-items: center;
          .carNobox {
            .txt {
              font-size: 13px;
              font-weight: bold !important;
              margin-bottom: 5px;
              color: #333;
            }
            .txt1 {
              font-size: 12px;
              color: #999;
            }
          }
        }

        .carStatus {
          background: rgba(14, 200, 89, 0.2);
          color: #187c17;
          border-radius: 4px;
          padding: 5px;
          font-size: 0.2rem;
          text-align: center;
          width: 1rem;
          margin-right: 5px;
        }
        .noCarStatus {
          background: rgba(255, 48, 33, 0.2);
          color: #ff1100;
          border-radius: 4px;
          padding: 5px;
          font-size: 0.2rem;
          text-align: center;
          width: 1rem;
          margin-right: 5px;
        }
      }

      .orderItem_rt {
        display: flex;
        align-items: center;
        align-self: center;
        justify-content: flex-start;
        color: #666;
        font-size: 0.24rem;

        .txt {
          font-size: 0.28rem;
          color: #161616;
        }

        .icon-tel {
          color: #fff;
          background: #35bc04;
          font-size: 0.32rem;
          padding: 0.1rem;
          border-radius: 50%;
          margin-right: 0.2rem;
        }

        .icon-wx {
          color: #409eff;
          font-size: 0.65rem;
        }
      }
    }

    .orderItem_content {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
      align-items: center;
      border-bottom: 1px solid rgba(216, 216, 216, 0.3);

      .orderItem_data {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 50%;
        margin-bottom: 6px;
        font-size: 0.28rem;
        box-sizing: content-box;
        color: #333;

        .order_label {
          font-size: 0.24rem;
          color: #999;
          // width: 1.8rem;
        }

        .txt {
          font-size: 0.24rem;
          color: #000;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }

        &.time {
          width: 100%;
        }
      }
    }

    .orderItem_label {
      .label_item {
        color: #fff;
        // border: 1px solid #35bc04;
        background: rgba(57, 117, 198, 1);
        border-radius: 2px;
        margin-right: 0.1rem;
        min-width: 0.4rem;
        padding: 4px 4px;
        text-align: center;
        font-size: 0.2rem;
        float: left;
        // margin-bottom: 0.1rem;
        margin-top: 8px;

        &:last-child {
          margin-right: 0;
        }
      }
    }

    .orderItem_file {
      background: #ebebeb;
      color: #333;
      border-radius: 5px;
      padding: 0.2rem 0;
      text-align: center;
      width: 100%;
      font-size: 0.28rem;
      display: flex;
      align-items: center;
      justify-content: center;

      .file_item {
        width: 33.33%;
        border-right: 1px solid #ccc;

        .icon-tel {
          font-size: 0.34rem;
          color: #35bc04;
          margin-right: 0.1rem;
        }

        .icon-mileage {
          font-size: 0.4rem;
          color: #409eff;
          margin-right: 0.1rem;
          position: relative;
          top: 0.04rem;
        }

        .icon-gw {
          font-size: 0.4rem;
          color: #409eff;
          margin-right: 0.1rem;
          position: relative;
          top: 0.04rem;
        }

        &:last-child {
          border: none;
        }
      }
    }
  }
}

.addBtn {
  position: fixed;
  bottom: 0.8rem;
  width: 100%;
  z-index: 1;

  .footerBtn {
    width: 2.8rem;
    margin: auto;
    text-align: center;
    font-size: 0.28rem;
    padding: 0.25rem 0rem;
    border-radius: 50px;
  }

  .orderItem_filebox {
    margin: auto;
    background: #409eff;
    color: #fff;
  }

  .comfirmBtn {
    background: #409eff;
    color: #fff;
  }

  .cancelBtn {
    border: 1px solid #ccc;
    color: #999;
    background: #fff;
  }
}

.noContent {
  margin-top: 2rem;
  background: #f2f2f2;
}

.task_header {
  background: url('~@/assets/images/title_bg.png') no-repeat center;
  height: 2.6rem;
  // height: 1.6rem;

  // background: url('~@/assets/images/taskbg.png') no-repeat center;
  font-size: 0.24rem;
  background-size: 100% 100%;

  .top_title {
    position: relative;
    width: 100%;
    height: 50px;

    .top_title_back {
      position: absolute;
      left: 10px;
      line-height: 50px;
      color: #fff;
    }

    .top_title_val {
      text-align: center;
      line-height: 50px;
      color: #fff;
      font-weight: bold;
      font-size: 16px;
    }
    .onlyPerson {
      position: absolute;
      right: 10px;
      color: #fff;
      top: 13px;
      clear: both;
      .onlyPerson_txt {
        font-size: 12px;
        color: #fff;
        margin-bottom: 5px;
      }
      .onlyPerson_switch {
        float: right;
      }
    }
  }

  .task_header_data {
    position: relative;
    .top_arrow {
      background: rgba(255, 255, 255, 0.7);
      border-radius: 50%;
      width: 20px;
      height: 20px;
      line-height: 20px;
      text-align: center;
      color: #3975c6;
      opacity: 0.4;
    }
    .top_left {
      position: absolute;
      top: 22px;
      left: 10px;
      z-index: 3;
    }
    .top_right {
      position: absolute;
      top: 22px;
      right: 10px;
      z-index: 3;
    }
    .task_header_date {
      display: flex;
      align-items: center;
      width: 80%;
      margin: auto;
      margin-bottom: 10px;

      .task_header_date_w {
        width: 30px;
      }

      .task_header_date_item {
        width: calc((100% - 30px) / 5);
        text-align: center;
        color: #fff;
        font-size: 14px;
      }
    }

    .task_header_followData {
      display: flex;
      align-items: center;
      color: #fff;
      width: 80%;
      margin: auto;
      margin-bottom: 10px;

      .task_header_followData_tt {
        width: 30px;
        text-align: center;
      }

      .task_header_followData_item {
        width: calc((100% - 30px) / 5);
        text-align: center;
        font-size: 12px;
        font-weight: bold;
        &.active {
          position: relative;
          &::after {
            content: '';
            width: 30px;
            height: 2px;
            position: absolute;
            bottom: -7px;
            left: 50%;
            margin-left: -15px;
            background: #fff;
          }
          // border-bottom: 1px solid #fff;
        }
      }
    }
  }
}

.top_search {
  display: flex;
  align-items: center;
  background: #f2f2f2;
  width: 100%;
  justify-content: space-between;

  .top_search_val {
    width: 100%;
  }

  .top_search_icon {
    width: 120px;
    position: relative;
    top: 2px;

    img {
      width: 100%;
    }
  }
}

.search_info {
  position: relative;
  .pop_content {
    box-sizing: border-box;
    padding: 20px;
    background: #fff;
    position: fixed;
    width: 85%;
    height: 100vh;
    overflow: auto;
    right: 0;
    top: 0;
    z-index: 11;
    padding-bottom: 60px;
  }
}

.mask {
  background: rgba(0, 0, 0, 0.5);
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 10;
}

.popSearch {
  font-size: 12px;
  width: 100%;
  padding-top: 20px;

  .popSearchbox {
    width: 100%;

    .popSearchbox_item {
      margin-bottom: 10px;

      .popSearch_tt {
        font-size: 0.24rem;
        font-weight: bold;
        margin-bottom: 12px;
        .tips {
          color: #ff4444;
        }
      }

      .popSearch_time {
        display: flex;
        align-items: center;

        .popSearch_time_txt {
          width: 45%;
          .popSearch_time_val {
            background: #f9f9f9;
            border-radius: 30px;
            text-align: center;
            padding: 7px 0;
            display: block;
            width: 100%;
          }
        }

        .popSearch_time_icon {
          margin: 0 10px;
        }
      }

      .popSearchbox_selectList {
        display: flex;
        flex-wrap: wrap;
        width: 100%;

        .popSearchbox_select_item {
          box-sizing: border-box;
          width: 32%;
          font-size: 0.2rem;
          padding: 7px 0;
          color: #4b4b4b;
          text-align: center;
          margin-right: 2%;
          margin-bottom: 12px;
          background: #f9f9f9;
          border-radius: 20px;
          border: 1px solid #f9f9f9;
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;

          &:nth-child(3n) {
            margin-right: 0;
          }

          &.active {
            color: #ff4444;
            background: #ffd8d3;
            border-radius: 62px 62px 62px 62px;
            border: 1px solid #dd5953;
          }
        }
      }
      /deep/ .van-cell {
        padding: 5px 0;
        font-size: 0.22rem;
        color: #4b4b4b;
      }
      /deep/ .van-cell::after {
        border: none;
      }
    }
  }
  .popSearch_footer {
    box-sizing: border-box;
    background: #fff;
    display: flex;
    padding: 10px 20px;
    width: 85%;
    z-index: 99;
    position: fixed;
    right: 0;
    bottom: 0;
    .popSearch_btn {
      font-size: 15px;
      box-sizing: border-box;
      width: 28%;
      padding: 10px 0;
      border-radius: 50px;
      margin-right: 8%;
      text-align: center;
      &:nth-child(3n) {
        margin-right: 0;
      }
      &.reset_btn {
        color: #dc2326;
        border: 1px solid #dd5953;
      }
      &.save_btn {
        color: #fff;
        background: linear-gradient(316deg, #3975c6 0%, #71a4ea 100%);
      }
      &.confirm_btn {
        color: #fff;
        background: linear-gradient(316deg, #3975c6 0%, #71a4ea 100%);
      }
    }
  }
}
.w65 {
  width: 60% !important;
}
.w35 {
  width: 40% !important;
}
.no_icon {
  padding: 25px;
  padding-top: 100px;
  background: #fff;
  .no_icon_img {
    width: 70px;
    display: block;
    margin: auto;
  }
  .no_icon_txt {
    font-weight: 400;
    font-size: 14px;
    color: #86909c;
    text-align: center;
    margin-top: 10px;
  }
}
</style>
<style scoped>
/deep/ .van-search {
  background: #f2f2f2;
}

/deep/ .van-pull-refresh {
  /* margin-top: 109px; */
  margin-top: 165px;
}
</style>
